package com.tttn.docbao.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;

import com.tttn.docbao.R;
import com.tttn.docbao.adapter.SplashAdapter;
import com.tttn.docbao.until.Core;

public class SplashActitivty extends Activity implements OnItemClickListener {
	private ListView lvnews;
	private SplashAdapter adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		setContentView(R.layout.activity_splash);
		lvnews = (ListView) findViewById(R.id.lvNews);
		adapter = new SplashAdapter(SplashActitivty.this, Core.getB());
		lvnews.setAdapter(adapter);
		lvnews.setOnItemClickListener(this);
		super.onCreate(savedInstanceState);
	}

	@Override
	public void onItemClick(AdapterView<?> parent, View view, int position,
			long id) {
		Intent intent = new Intent(SplashActitivty.this, MainActivity.class);
		Bundle bundle = new Bundle();

		bundle.putString("name", Core.getB().get(position));
//		Toast.makeText(getApplicationContext(), Core.getB().get(position), Toast.LENGTH_SHORT).show();
		intent.putExtra("DATA", bundle);
		startActivity(intent);

	}

}
